home *** CD-ROM | disk | FTP | other *** search
- /*******************************************************************************
- * Copyright © 1992-1993 Mark Pilgrim *
- * *
- * This file is provided as is, and may be freely distributed unaltered. This *
- * message must accompany any copy of this file. This file may be used or *
- * modified for use for a non-commercial product provided that appropriate *
- * credit is given to the author named above. *
- * Commercial use of this source code is prohibited. *
- ******************************************************************************/
-
- #include "msg misc.h"
- #include "msg timing.h"
-
- #define BoxSize 10
- #define CorrectTime 3
-
- void HalvesScroll(GrafPtr);
-
- /* 2 regions, split down the middle of the screen. Scroll the screen up in one
- region and down in the other. */
-
- void HalvesScroll(GrafPtr sourceGrafPtr)
- {
- int x;
- Rect theTopRect, topdest, theBottomRect, bottomdest;
- Rect topscrollsource, topscrolldest, bottomscrollsource, bottomscrolldest;
- RgnHandle toprgn,bottomrgn;
- int cx;
-
- cx = MAIN_WINDOW_WIDTH / 2;
-
- toprgn=NewRgn();
- SetEmptyRgn(toprgn);
- MoveTo(0,0);
- OpenRgn();
- Line(cx,0);
- LineTo(cx,MAIN_WINDOW_HEIGHT);
- LineTo(0,MAIN_WINDOW_HEIGHT);
- LineTo(0,0);
- CloseRgn(toprgn);
-
- bottomrgn=NewRgn();
- SetEmptyRgn(bottomrgn);
- MoveTo(cx,0);
- OpenRgn();
- LineTo(cx,MAIN_WINDOW_HEIGHT);
- LineTo(MAIN_WINDOW_WIDTH,MAIN_WINDOW_HEIGHT);
- LineTo(MAIN_WINDOW_WIDTH,0);
- LineTo(cx,0);
- CloseRgn(bottomrgn);
-
- topscrollsource=gMainWindow->portRect;
- topscrollsource.bottom-=BoxSize;
- topscrollsource.right=cx;
- topscrolldest = topscrollsource;
- OffsetRect(&topscrolldest, 0, BoxSize);
-
- topdest = gMainWindow->portRect;
- topdest.bottom=BoxSize;
- topdest.right=cx;
-
- theTopRect.top=MAIN_WINDOW_HEIGHT-BoxSize;
- theTopRect.bottom=MAIN_WINDOW_HEIGHT;
- theTopRect.left=0;
- theTopRect.right=cx;
-
- bottomscrollsource=gMainWindow->portRect;
- bottomscrollsource.top+=BoxSize;
- bottomscrollsource.left=cx;
- bottomscrolldest=bottomscrollsource;
- OffsetRect(&bottomscrolldest, 0, -BoxSize);
-
- bottomdest=gMainWindow->portRect;
- bottomdest.top=bottomdest.bottom-BoxSize;
- bottomdest.left=cx;
-
- theBottomRect.top=0;
- theBottomRect.bottom=BoxSize;
- theBottomRect.left=cx;
- theBottomRect.right=MAIN_WINDOW_WIDTH;
-
- for(x = MAIN_WINDOW_HEIGHT - BoxSize; x >= 0; x -= BoxSize)
- {
- StartTiming();
- CopyBits(&(gMainWindow->portBits), &(gMainWindow->portBits),
- &topscrollsource, &topscrolldest, 0, toprgn);
- CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
- &theTopRect, &topdest, 0, toprgn);
- theTopRect.bottom-=BoxSize;
- theTopRect.top-=BoxSize;
-
- CopyBits(&(gMainWindow->portBits), &(gMainWindow->portBits),
- &bottomscrollsource, &bottomscrolldest, 0, bottomrgn);
- CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
- &theBottomRect, &bottomdest, 0, bottomrgn);
- theBottomRect.top+=BoxSize;
- theBottomRect.bottom+=BoxSize;
-
- TimeCorrection(CorrectTime);
- }
- }